package org.example.math;

/**
 * @Description: TODO
 * @Author wyatt
 * @Data 2024/07/28 11:51
 */
public class PointDistance {

    public static void main(String[] args) {
        double x1 = 4.0;
        double y1 = 6.0;
        double x2 = 1.0;
        double y2 = 2.0;

        double distance = calculateDistance(x1, y1, x2, y2);
        System.out.println("两点之间的距离为： " + distance);
    }

    public static double calculateDistance(double x1, double y1, double x2, double y2) {
        double deltaX = x2 - x1;
        double deltaY = y2 - y1;
        return Math.sqrt(Math.pow(deltaX, 2) + Math.pow(deltaY, 2));
    }
}
